{% block form %}
    {% set url = admin.id(object) ? 'edit' : 'create' %}

    {% if not admin.hasRoute(url)%}
<div>
            {{ "form_not_available"|trans({}, "SonataAdminBundle") }}
    </div>
    {% else %}
    <div id="systemUser" class="box">
        <div class="head">
            <h1 id="UserHeading">Add User</h1>
        </div>
        <div class="inner">

            <form class="form-horizontal" action="{{ admin.generateUrl(url, {'id': admin.id(object), 'uniqid': admin.uniqid, 'subclass': app.request.get('subclass')}) }}" {{ form_enctype(form) }} method="POST">
                <fieldset style="width: 100%">


{% if form.vars.errors|length > 0 %}
                    <ol class="sonata-ba-form-error">
                    {{ form_errors(form) }}
                        </ol>
            {% endif %}

            {% block sonata_pre_fieldsets %}{% endblock %}
                        <ol>
            {% for name, form_group in admin.formgroups %}

                                <li>
                        {% for field_name in form_group.fields %}

                            {% if admin.formfielddescriptions[field_name] is defined %}
                                {{ form_row(form[field_name])}}
                            {% endif %}
                        {% endfor %}
                                    </li>                

            {% endfor %}
                                </ol>
            {% block sonata_post_fieldsets %}{% endblock %}

            {{ form_rest(form) }}

            {% block formactions %}
                                <div class="well form-actions">
                    {% if app.request.isxmlhttprequest %}
                        {% if admin.id(object) %}
                                        <input type="submit" class="btn btn-primary" name="btn_update" value="{{ 'btn_update'|trans({}, 'SonataAdminBundle') }}"/>
                        {% else %}
                                        <input type="submit" class="btn" name="btn_create" value="{{ 'btn_create'|trans({}, 'SonataAdminBundle') }}"/>
                        {% endif %}
                    {% else %}
                        {% if admin.supportsPreviewMode %}
                                        <input class="btn btn-info persist-preview" name="btn_preview" type="submit" value="{{ 'btn_preview'|trans({}, 'SonataAdminBundle') }}"/>
                        {% endif %}
                        {% if admin.id(object) %}
                                        <input type="submit" class="btn btn-primary" name="btn_update_and_edit" value="{{ 'btn_update_and_edit_again'|trans({}, 'SonataAdminBundle') }}"/>
                                        <input type="submit" class="btn" name="btn_update_and_list" value="{{ 'btn_update_and_return_to_list'|trans({}, 'SonataAdminBundle') }}"/>

                            {% if admin.hasroute('delete') and admin.isGranted('DELETE', object) %}
                                {{ 'delete_or'|trans({}, 'SonataAdminBundle') }}
                                        <a class="btn btn-danger" href="{{ admin.generateObjectUrl('delete', object) }}">{{ 'link_delete'|trans({}, 'SonataAdminBundle') }}</a>
                            {% endif %}
                        {% else %}
                                        <input class="btn btn-primary" type="submit" name="btn_create_and_edit" value="{{ 'btn_create_and_edit_again'|trans({}, 'SonataAdminBundle') }}"/>
                                        <input type="submit" class="btn" name="btn_create_and_list" value="{{ 'btn_create_and_return_to_list'|trans({}, 'SonataAdminBundle') }}"/>
                                        <input class="btn" type="submit" name="btn_create_and_create" value="{{ 'btn_create_and_create_a_new_one'|trans({}, 'SonataAdminBundle') }}"/>
                        {% endif %}
                    {% endif %}
                                    </div>
            {% endblock formactions %}
                            </form>
                            </fieldset> 
                        </div>
    {% endif%}

{% endblock %}
